#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

class Solution {
public:
	void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
		vector<int> res;
		nums1.erase(nums1.begin() + m, nums1.end());
		vector<int>::iterator n1it = nums1.begin(), n2it = nums2.begin();
		while (n1it!=nums1.end()&&n2it!=nums2.end()) {
			if (*n1it > *n2it) {
				res.push_back(*n2it);
				n2it++;
			}
			else {
				res.push_back(*n1it);
				n1it++;
			}
		}
		while (n1it != nums1.end()) {
			res.push_back(*n1it);
			n1it++;
		}
		while (n2it != nums2.end()) {
			res.push_back(*n2it);
			n2it++;
		}
		nums1 = res;
	}

	void mergeBySort(vector<int>& nums1, int m, vector<int>& nums2, int n) {
		for (int i = m, int j = 0; i < m + n; i++, j++)
			nums1[i] = nums2[j];
		sort(nums1.begin(), nums1.end());
	}


};

int main() {
	vector<int> arr1 = { };
	vector<int> arr2 = {1 };
	Solution s;
	s.merge(arr1, 0, arr2, 1);
}